//
//  QLYDNetWorkTools.m
//  QLYDNetWork
//
//  Created by fb on 2020/12/10.
//

#import "QLYDNetWorkTools.h"

@implementation QLYDNetWorkTools
#pragma mark  格式化NSNULL，Null，@“”，<NULL>,<null>

/**
 格式化NSNULL，Null，@“”，<NULL>,<null>
 
 @param string 字符串
 @return <#return value description#>
 */
+(NSString *)stringFormat:(id)string {
    if([string isKindOfClass:[NSNull class]]) {
        return @"";
    }
    if([string isKindOfClass:[NSString class]]) {
        
        if([string isEqualToString:@"null"]||[string isEqualToString:@"<null>"]||[string isEqualToString:@"(null)"]){
            return @"";
        }
        
        return string;
    }
    
    if([string isKindOfClass:[NSNumber class]]){
        NSString *temp = [NSString stringWithFormat:@"%@",string];
        temp = [NSString stringWithFormat:@"%.2f",[temp doubleValue]];
        NSDecimalNumber *decNumber = [NSDecimalNumber decimalNumberWithString:temp];
        return [decNumber stringValue];
        
    }
    return @"";
}
@end
